<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>LikeShopping</title>
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
        <script>
            function login() {
                let username = document.getElementById("username").value;
                let password = document.getElementById("password").value;
                $.ajax({
                    type: "POST",
                    url: "http://127.0.0.1:8080/login_v2", // 替换成实际的接口URL
                    contentType: "application/json",
                    data: JSON.stringify({"user": username, "password": password}), // 如果有需要传递的数据，在这里添加
                    success: function(response) {
                        // 在这里处理登录成功的情况
                    },
                    error: function(xhr, status, error) {
                        console.log("Error occurred while fetching data:", xhr.status, error);

                    }

                });

            }
        </script>
    </head>
    <body>
        <input id="username" type="text" placeholder="用户名">
        <input id="password" type="password" placeholder="密码">
        <button id="login" onclick="login()">登录</button>

    </body>
</html>
